<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/31
 * Time: 15:49
 */

namespace app\api\model;


class Money extends BaseModel
{
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;

    public static function getCurrentMoney($uid){
        $res = self::where('user_id','=',$uid)->order('create_time desc')->find();
        if(!$res){
            return 0;
        }

        return $res->current_money;
    }

    public static function getMoneyRecords($uid,$page){
        return self::where('user_id','=',$uid)->order('create_time desc')->paginate(12,true,['page'=>$page]);
    }
}